import { Devcloud, DevcloudNoloading } from "../apiClass"
import { IResult } from "../../plugins/Interfaces"


export class ModuleBuildApi extends Devcloud {
  private baseUrl: string = this.path + 'moduleBuild/';
  async build(param:any):Promise<IResult> {
    const resp = await this.client.post(this.baseUrl + "build", param)
    return resp.data
  }
  async page(param:any):Promise<IResult> {
    const resp = await this.client.post(this.baseUrl + "page", param)
    return resp.data
  }
  async listRunEnable(param:any):Promise<IResult> {
    const resp = await this.client.post(this.baseUrl + "listRunEnable", param)
    return resp.data
  }
  async log(buildId:string, bufferOffset?:number):Promise<IResult> {
    const resp = await this.client.get(this.baseUrl + "log", {buildId:buildId, bufferOffset:bufferOffset})
    return resp.data
  }
}

export class ModuleBuildNoloadingApi extends DevcloudNoloading{
  private baseUrl: string = this.path + 'moduleBuild/';
  async log(buildId:string, bufferOffset?:number):Promise<IResult> {
    const resp = await this.client.get(this.baseUrl + "log", {buildId:buildId, bufferOffset:bufferOffset})
    return resp.data
  }
}